// API配置文件
export const API_CONFIG = {
  // 基础URL
  BASE_URL: '/api',
  
  // 超时时间
  TIMEOUT: 15000,
  
  // 采购模块API端点
  PURCHASE: {
    // 采购订单
    ORDER: {
      LIST: '/procurement/purchase/order/page',
      DETAIL: '/procurement/purchase/order/getById',
      ADD: '/procurement/purchase/order',
      UPDATE: '/procurement/purchase/order',
      DELETE: '/procurement/purchase/order',
      GENERATE_NO: '/procurement/purchase/order/generateOrderNo',
      EXPORT: '/procurement/purchase/order/export'
    },
    
    // 采购退货
    RETURN: {
      LIST: '/procurement/purchase/return/page',
      DETAIL: '/procurement/purchase/return/detail',
      ADD: '/procurement/purchase/return/add',
      UPDATE: '/procurement/purchase/return/update',
      DELETE: '/procurement/purchase/return/delete',
      EXPORT: '/procurement/purchase/return/export',
      PROCESS: '/procurement/purchase/return/process'
    },
    
    // 采购入库
    STORAGE: {
      LIST: '/procurement/purchase/storage/page',
      DETAIL: '/procurement/purchase/storage/detail',
      ADD: '/procurement/purchase/storage/add',
      UPDATE: '/procurement/purchase/storage/update',
      DELETE: '/procurement/purchase/storage/delete',
      EXPORT: '/procurement/purchase/storage/export'
    },
    
    // 供应商管理
    SUPPLIER: {
      LIST: '/procurement/supplier/page',
      DETAIL: '/procurement/supplier/detail',
      ADD: '/procurement/supplier/add',
      UPDATE: '/procurement/supplier/update',
      DELETE: '/procurement/supplier/delete',
      EXPORT: '/procurement/supplier/export'
    }
  },
  
  // 用户管理
  USER: {
    LIST: '/system/user/page',
    DETAIL: '/system/user/detail',
    ADD: '/system/user/add',
    UPDATE: '/system/user/update',
    DELETE: '/system/user/delete',
    DROPDOWN: '/system/user/dropdown'
  },
  
  // 字典数据
  DICT: {
    PURCHASE_TYPE: 'purchase_type',
    STORAGE_STATUS: 'storage_status',
    PAYMENT_STATUS: 'payment_status',
    RETURN_STATUS: 'return_status'
  }
}

// 响应状态码
export const RESPONSE_CODE = {
  SUCCESS: 200,
  ERROR: 500,
  UNAUTHORIZED: 401,
  FORBIDDEN: 403,
  NOT_FOUND: 404
}

// 分页默认配置
export const PAGINATION_CONFIG = {
  DEFAULT_PAGE_SIZE: 10,
  PAGE_SIZES: [5, 10, 20, 50, 100],
  LAYOUT: 'prev, pager, next, sizes'
}

// 表格配置
export const TABLE_CONFIG = {
  DEFAULT_HEIGHT: 'calc(100vh - 300px)',
  STRIPE: true,
  BORDER: true,
  SHOW_HEADER: true,
  HIGHLIGHT_CURRENT_ROW: true
}

// 表单验证规则
export const VALIDATION_RULES = {
  REQUIRED: (message) => ({ required: true, message, trigger: 'blur' }),
  NUMBER: (min = 0, message) => ({ type: 'number', min, message }),
  EMAIL: { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' },
  PHONE: { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
}

